<div class="fsh-pop">
    <div id="add_form" class="layui-form" lay-filter="add_form">
        <div class="layui-form-item">
            <label class="layui-form-label"><i>*</i>名称</label>
            <div class="layui-input-block">
                <input type="hidden" name="permission_id">
                <input type="text" name="permissionName" lay-verify="required" placeholder="请输入内容" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label"><i>*</i>菜单编号</label>
            <div class="layui-input-block">
                <input name="permissionKey"  lay-verify="required" placeholder="请输入内容" class="layui-input">
            </div>
        </div>
         <div class="layui-form-item layui-form-text">
            <label class="layui-form-label"><i>*</i>父级菜单</label>
            <div class="layui-input-block">
                    <input name="parent_key"  lay-verify="required" autocomplete="off" placeholder="请选择父级菜单" class="layui-input" id="parent_key">
                    <input type="hidden" name="parent_keys" id="parent_keys">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label"><i>*</i>请求地址</label>
            <div class="layui-input-block">
                <input name="url" lay-verify="required" placeholder="请输入内容" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">排序</label>
            <div class="layui-input-block">
                <input name="sort" type="number" placeholder="请输入内容" class="layui-input" value="1">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">菜单</label>
            <div class="layui-input-block">
                <input type="radio" class="layui-input" value="Y"  name="menu_flag" title="是" checked>
                <input type="radio" class="layui-input" value="N"  name="menu_flag" title="否">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">请求方式</label>
            <div class="layui-input-block">
                <select name="method">
                    <option value="GET">GET</option>
                    <option value="POST">POST</option>
                    <option value="PATCH">PATCH</option>
                    <option value="DELETE">DELETE</option>
                    <option value="PUT">PUT</option>
                </select>
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">图标</label>
            <div class="layui-input-block">
                <input class="layui-input" value="" name="icon" >
            </div>
        </div>

  </div>
</div>
<script>
    layui.use(['form'], function () {
        var _formObj = JSON.parse($('<div>').html('<%=$data%>').text())||{};
        console.log(_formObj);
        if(_formObj) {
            layui.form.val('add_form', _formObj);
        }
    });

   $("#parent_key").click(function(){
    showDialog({
                title: '选择父级菜单'
                ,template: 'views/system/per/template/menu.html'
                ,width:400
                ,height:600
                , yes: function (index, layero) {
                    var res = callbackdata(); 
                    layer.close(index);
                    $("#parent_key_name").val(res.title);
                    $("#parent_key").val(res.key);
                    $("#parent_keys").val(res.keys);
                }
            });

   });


   // $("#parent_key").click(function () {
   //     showDialog({
   //         title: '选择父级菜单'
   //         , template: 'views/system/menu/template/per.html'
   //         , width: 400
   //         , height: 600
   //         , yes: function (index, layero) {
   //             layer.close(index);
   //             var res = callbackdata();
   //             layer.close(index);
   //             $("#parent_key_name").val(res.title);
   //             $("#parent_key").val(res.key);
   //             $("#parent_keys").val(res.keys);
   //         }
   //
   //     });
   // });
</script>
